package algorithm;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Test {
    public static void main(String[] args) {
        Date date = new Date();
        System.out.println(date);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String nowDate = sdf.format(date);
        System.out.println(nowDate);


        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar.getTimeInMillis());
        System.out.println(calendar.get(Calendar.YEAR));
        System.out.println(sdf.format(calendar.getTime()));

        long d = System.currentTimeMillis();
        System.out.println(d);
    }
}
